package admin.DAO;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import admin.DTO.EmployeeDTO;

public class EmployeeDAOImpl extends SqlMapClientDaoSupport implements EmployeeDAO{

	@Override
	public EmployeeDTO login(EmployeeDTO dto) throws SQLException {
		return (EmployeeDTO) this.getSqlMapClient().queryForObject("em.login", dto);
	}

	@Override
	public void employeeJoin(EmployeeDTO dto) throws SQLException {
		this.getSqlMapClient().insert("em.employeeJoin",dto);
	}

	@SuppressWarnings("unchecked")
	@Override
	public ArrayList<EmployeeDTO> searchEmployee(EmployeeDTO dto) throws SQLException {
		return (ArrayList<EmployeeDTO>) this.getSqlMapClient().queryForList("em.searchEmployee", dto);
	}

	@Override
	public EmployeeDTO employeeDetial(EmployeeDTO dto) throws SQLException {
		return (EmployeeDTO) this.getSqlMapClient().queryForObject("em.employeeDetial", dto);
	}

	@Override
	public int employeeModify(EmployeeDTO dto) throws SQLException {
		return this.getSqlMapClient().update("em.employeeModify", dto);
	}

	@Override
	public void employeeDelete(int no) throws SQLException {
		this.getSqlMapClient().delete("em.employeeDelete", no);
	}

}
